<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文本</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
  function tipOpen1(ele) {
    var cwid = $(ele).prev().val();
    $(".tipright p").text("确定此订单发货吗?");
    $("#tip").fadeIn(200);
    $("#cwid").val(cwid);
    $("#status").val(1);
  }

  function tipOpen2(ele) {
    var cwid = $(ele).prev().val();
    $(".tipright p").text("确定取消此订单吗?");
    $("#tip").fadeIn(200);
    $("#cwid").val(cwid);
    $("#status").val(2);

  }

  function tipOpen3(ele) {
    var cwid = $(ele).prev().val();
    $(".tipright p").text("确定回款吗?");
    $("#tip").fadeIn(200);
    $("#cwid").val(cwid);
    $("#status").val(3);

  }

  function tipOpen4(ele) {
    var cwid = $(ele).prev().val();
    $(".tipright p").text("确认已退货吗?");
    $("#tip").fadeIn(200);
    $("#cwid").val(cwid);
    $("#status").val(4);

  }
// function tipOpen(content) {
// 	$(".tipright p").text(content);
//   $("#tip").fadeIn(200);
//   }
function tipClose() {
	$("#tip").fadeOut(200);
}
  function tipQueding() {
    $("#tip").fadeOut(200);
    var cwid = $("#cwid").val();
    var status=$("#status").val();
    window.location.href="/erp1/rep/ckware/editStatus?ckwid="+cwid+"&status="+status;
  }
function goPage(num) {
  $("#pageno").val(num);
  $("#ckwareform").submit();
}
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>仓库管理</li>
    <li>出库管理</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form action="/erp1/rep/ckware/allckware" method="post" id="ckwareform">
    <ul class="tools">
      <li>仓库名称:
        <input type="text" name="wareName" th:value="${wareName}" />
        <input type="hidden" name="pageno" value="1" id="pageno"/>
      </li>
      <li>订单编号:
        <input type="text" name="indent" th:value="${indent}" />
      </li>
      <li>状态:
        <select name="state">
        	<option value="">请选择</option>
           <option th:each="m : ${map}" th:value="${m.key}" th:text="${m.value}" th:selected="${state==m.key}"></option>
        </select>
      </li>
      <li class="subBut" onclick="goPage(1)"><img th:src="@{/images/t06.png}"/>查询</li>
      <li class="subBut" onclick="window.location.href='/erp1/rep/ckware/goAdd'"><img th:src="@{/images/t01.png}" />添加出库</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>订单编号</th>
          <th>金额</th>
          <th>仓库名称</th>
          <th>出库时间</th>
          <th>出库人</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="c,var : ${ckinfo.list}">
          <td th:text="${var.count+(ckinfo.pageNum-1)*ckinfo.pageSize}"></td>
          <td th:text="${c.indent}"></td>
          <td th:text="${c.orders==null?'':c.orders.ordermoney}"></td>
          <td th:text="${c.warehouse.cName}"></td>
          <td th:text="${#dates.format(c.cDate,'yyyy-MM-dd')}"></td>
          <td th:text="${c.userId==null?'':c.users.uname}"></td>
          <td th:if="${c.state.equals('1')}">未发货</td>
          <td th:if="${c.state.equals('2')}">已发货</td>
          <td th:if="${c.state.equals('3')}">已回款</td>
          <td th:if="${c.state.equals('4')}">取消订单</td>
          <td th:if="${c.state.equals('5')}">已退货</td>
          <td>
          	<a th:href="'/erp1/rep/ckware/detail/'+${c.id}" class="tablelink">查看详情</a>
            <input type="hidden" th:value="${c.id}"/>
            <a href="javascript:void(0)" class="tablelink" th:if="${c.state.equals('1')}" onclick="tipOpen1(this)">发货</a>
            <input type="hidden" th:value="${c.id}"/>
            <a href="javascript:void(0)" class="tablelink"  th:if="${!c.state.equals('4')&&!c.state.equals('5')}" onclick="tipOpen2(this)">取消订单</a>
            <input type="hidden" th:value="${c.id}"/>
            <a href="javascript:void(0)" class="tablelink"  th:if="${c.state.equals('2')}" onclick="tipOpen3(this)">确认回款</a>
            <input type="hidden" th:value="${c.id}"/>
            <a href="javascript:void(0)" class="tablelink"  th:if="${c.state.equals('4')}" onclick="tipOpen4(this)">确认已退货</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${ckinfo.total}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${ckinfo.pageNum+'&nbsp;'}">2</i>页
      </div>
      <ul class="paginList">
        <li class="paginItem">
          <a href="javascript:void(0);" th:onclick="goPage([[${ckinfo.isFirstPage?1:ckinfo.pageNum-1}]])">
            <span th:class="${ckinfo.isFirstPage?'pagepre':'pagenxt roate'}"></span>
          </a>
        </li>
        <li th:class="${page==ckinfo.pageNum?'paginItem current':'paginItem'}"
            th:each="page : ${ckinfo.navigatepageNums}">
          <a href="javascript:;" th:text="${page}" th:onclick="goPage([[${page}]])">1</a>
        </li>
        <li class="paginItem">
          <a href="javascript:void(0);"
             th:onclick="goPage([[${ckinfo.isLastPage?ckinfo.pages:ckinfo.pageNum+1}]])">
            <span th:class="${ckinfo.isLastPage?'pagepre roate':'pagenxt'}"></span>
          </a>
        </li>
      </ul>
    </div>
  </form>
  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
    <div class="tipinfo"> <span><img src="../../images/ticon.png" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input type="hidden" id="cwid"/>
      <input type="hidden" id="status"/>
      <input name="" type="button"  class="sure" value="确定" onclick="tipQueding()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose()" />
    </div>
  </div>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
